<?php
 
   $lot=$_GET["lot"];
   $dbName = "sqlsrv:Server=172.31.3.12,1433;Database=emc3030";   //这里是服务器IP地址和数据库名，端口不是默认的话记得改一下
   $dbUser = "sa";
	$dbPassword = "TDled!2018";    //登陆密码
   $db = new PDO($dbName, $dbUser, $dbPassword);   
   
   if ($db){
	$sql = "select id  from sl_bag where  ctype='1' and clotno='".$lot."'";//17620T4003-7250613 菲利浦
	
	$res = $db->query($sql);
	
	$bid="";
	//print_r($res);
	 while ($row = $res->fetch()){
	  $bid=$row['id'];
	 }
	$res = null;
	$sql = "select clotno  from sl_bags where  id= '".$bid."'";//17620T4003-7250613
	$res2 = $db->query($sql);
	$rdisk="";
	$row = null;
	 while ($row = $res2->fetch()){
	  $rdisk.= $row['clotno'].",";
	 }
	 print_r($rdisk);
	goto OUT
   }else{
	$dbName_2 = "sqlsrv:Server=172.31.3.12,1433;Database=UFDATA_001_2017";   //这里是服务器IP地址和数据库名，端口不是默认的话记得改一下
	$db_2 = new PDO($dbName_2, $dbUser, $dbPassword);
	$sql = "select Clotno from ldx_SeoulInsideMX where InsideboxNO='".$lot."'";//17620T4003-7250613 菲利浦
	
	$res = $db_2->query($sql);
	
	$rdisk="";
	$row = null;
	while ($row = $res->fetch()){
	  $rdisk.= $row['clotno'].",";
	 }
	 
	 print_r($rdisk);
	//$rdisk = implode(',', $res);
	$db_2 = null;
   goto OUT}
	 
 OUT:
	$res2 = null;
	$db = null;

	
